package com.easy.component.component.header;

import android.view.View;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;

import com.easy.component.R;

/**
 * 描述: {描述}
 * 作者:jack-song
 * 创建日期: 2017/11/2 11:38
 * 修改日期: 2017/11/2
 * 版本: {版本}
 */
public abstract class EaseyBaseHeader<T extends EaseyBaseHeader> {
    /**
     * 头部布局
     */
    protected View containerView;
    /**
     * 头部背景
     */
    protected RelativeLayout rlHeaderContainerView;
    /**
     * 左侧布局文件
     */
    protected LinearLayout leftContainerView;
    /**
     * 右侧布局文件
     */
    protected LinearLayout rigthContainerView;

    /**
     * 设置布头部布局文件
     */
    protected T setContainerView(View containerView) {
        this.containerView = containerView;
        leftContainerView = containerView.findViewById(R.id.ll_left);
        rigthContainerView = containerView.findViewById(R.id.ll_rigth);
        rlHeaderContainerView = containerView.findViewById(R.id.rl_bg);
        return (T) this;
    }

    /**
     * 添加左侧
     *
     * @param leftView
     */
    protected T addLeftContainerView(View leftView) {
        leftContainerView.addView(leftView);
        return (T) this;
    }

    /**
     * 添加右侧
     *
     * @param rigthView
     */
    protected T addRigthContainerView(View rigthView) {
        rigthContainerView.addView(rigthView);
        return (T) this;
    }

}
